package com.yh.rent.entity;

import java.util.Set;
import java.util.TreeSet;

import javax.persistence.*;

/**
 * 
 * ��������rent��Ŀ ��Ӧ�ķ������ͱ�  
 *  
 * @author: Administrator  
 * @date�� 2017-10-31 3:56:55 PM  
 * @version 1.0
 */
@Entity
@Table(name = "types")
public class Type {
	private Integer id ; //����id ����
	private String name ; //��������
	private Set<House> houses = new TreeSet<>() ;
	
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE , generator = "mygenerator")
	@SequenceGenerator(name = "mygenerator" , sequenceName = "type_seq", initialValue = 1 , allocationSize = 1 )
	@Column(name="type_id")
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	@Column(name = "name")
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@OneToMany(cascade=CascadeType.ALL, mappedBy="type")
	public Set<House> getHouses() {
		return houses;
	}
	public void setHouses(Set<House> houses) {
		this.houses = houses;
	}
	@Override
	public String toString() {
		return "Type [id=" + id + ", name=" + name + "]";
	}
}
